<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui">
 
  <ui:composition template="/pages/templates/commonLayoutAdm.xhtml">

	
	<ui:define name="content">

	<h:form>
		
		<center>
		

			<p:panel style="width:70%;align:center;valign:middle;">
			<h:panelGrid id="panel" columns="3" cellpadding ="5" >
				
				<p:outputLabel value="Nome do responsável:" ></p:outputLabel>
				<p:inputText id="nomeresp" size="50" value="#{beanCadastroClinica.nomeResponsavel}" required="true">
					<f:validateLength minimum="3" />
				</p:inputText>
				<p:message for="nomeresp" display="icon" id="msgnomeprof" />
				
				<p:outputLabel value="CPF do responsável:" ></p:outputLabel>
				<p:inputMask id="cpf" size="12" mask="999.999.999-99" value="#{beanCadastroClinica.cpfResponsavel}" required="true">
					<f:validateLength minimum="14"  />
				</p:inputMask>
				<p:message for="cpf" display="icon" />
				
				<p:outputLabel value="Nome da clínica:" ></p:outputLabel>
				<p:inputText id="clinica" size="50" value="#{beanCadastroClinica.nomeClinica}" required="true">
					<f:validateLength minimum="3" />
				</p:inputText>
				<p:message for="clinica" display="icon" />
				
				<p:outputLabel value="CNPJ da clínica:"></p:outputLabel>
				<p:inputMask id="cnpj" size="16" mask="99.999.999/9999-99" value="#{beanCadastroClinica.cnpjClinica}"
				required="true">
					<f:validateLength minimum="18" />
				</p:inputMask>
				<p:message for="cnpj" display="icon" />

				
				<p:outputLabel value="Endereço:" ></p:outputLabel>
				<p:inputText id="endereco" size="50" value="#{beanCadastroClinica.endereco}" required="true">
					<f:validateLength minimum="3" />
				</p:inputText>
				<p:message for="endereco" display="icon" />
				
				<p:outputLabel value="Número:" ></p:outputLabel>
				<p:inputText id="numero" size="5" value="#{beanCadastroClinica.numero}" required="true">
					<f:validateLength minimum="1" />
				</p:inputText>
				<p:message for="endereco" display="icon" />
				
				<p:outputLabel value="Complemento:" ></p:outputLabel>
				<p:inputText id="complemento" size="20" value="#{beanCadastroClinica.complemento}"></p:inputText>
				<p:message for="complemento" display="icon" />
				
				<p:outputLabel value="Bairro:" ></p:outputLabel>
				<p:inputText id="bairro" size="20" value="#{beanCadastroClinica.bairro}" required="true">
					<f:validateLength minimum="1" />
				</p:inputText>
				<p:message for="bairro" display="icon" />
				
				<p:outputLabel value="Cidade:" ></p:outputLabel>
				<p:inputText id="cidade" size="20" value="#{beanCadastroClinica.cidade}" required="true">
					<f:validateLength minimum="1" />
				</p:inputText>
				<p:message for="cidade" display="icon" />
				
				<p:outputLabel value="Estado:" ></p:outputLabel>
				<p:selectOneMenu value="#{beanCadastroClinica.selectedEstado}">
    				<f:selectItems value="#{beanCadastroClinica.estados}" />
				</p:selectOneMenu>
				<p:outputLabel value="" ></p:outputLabel>
				
				<p:outputLabel value="Telefone 1:" />
        		<p:inputMask id="telefone1" size="12" value="#{beanCadastroClinica.telefone1}" mask="(99) 9999-9999?9" required="true">
        			<f:validateLength minimum="14" maximum="15"/>
        		</p:inputMask>
				<p:message for="telefone1" display="icon" />
				
				<p:outputLabel value="Telefone 2:" />
        		<p:inputMask id="telefone2" size="12" value="#{beanCadastroClinica.telefone2}" mask="(99) 9999-9999?9" required="false" >
        			<f:validateLength minimum="14" maximum="15"/>
        		</p:inputMask>
				<p:message for="telefone2" display="icon" />
				
        		<p:outputLabel value="Telefone 3:" /> 
        		<p:inputMask id="telefone3" size="12" value="#{beanCadastroClinica.telefone3}" mask="(99) 9999-9999?9" required="false">
        			<f:validateLength minimum="14" maximum="15"/>
        		</p:inputMask>
				<p:message for="telefone3" display="icon" />
				
				<p:outputLabel value="Login:" ></p:outputLabel>
				<p:inputText id="login" size="20" value="#{beanCadastroClinica.login}" required="true">
					<f:validateLength minimum="5"/>
					<p:ajax update="msgLogin" event="keyup" />
				</p:inputText>
				<p:message id="msgLogin" for="login" display="icon" />
				
				<p:outputLabel value="Senha:" ></p:outputLabel>
				<p:password id="senha" size="12" required="true" value="#{beanCadastroClinica.senha}">
					<f:validateLength minimum="5"/>
					 <p:ajax update="msgSenha" event="keyup" />
				</p:password>
				<p:message id="msgSenha" for="senha" display="icon" />
				
			</h:panelGrid>		
			
			<p:commandButton value="Concluir" action="#{beanCadastroClinica.criaClinica()}" update="panel" >
			</p:commandButton>
			</p:panel>
		</center>
	
	</h:form>
</ui:define>

</ui:composition>

</html>